
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Tama_Chan.AI;
using Tama_Chan.GameEngine_ns;
using Tama_Chan.Utils;


namespace Tama_Chan.Entities_ns
{
   public class Food : GameEntity
   {

      public Food(GameEngine gameEngine, Vector2 position)
      {
         GameEngine = gameEngine;
         Texture = GameEngine.CircleTexture;
         Position = position;
         Color = Color.LawnGreen;
         ScoreValue = 10;
         Speed = 10;
         IntervalOne = GeneralUtils.GetSecondsAsTicks(1);
         SoundOne = GameEngine.GulpSoundEffect.CreateInstance();
         SoundTwo = GameEngine.HitWallSoundEffect.CreateInstance();
         Velocity = AIUtils.GetRandomVelocity(Speed, Random);
         Depth = GameEngine.EnemyDepth;
         HealthValue = 5;
      }


      public override void Update(GameTime gameTime)
      {
         AccumulatedTicksOne += gameTime.ElapsedGameTime.Ticks;
         if(AccumulatedTicksOne > IntervalOne)
         {
            AccumulatedTicksOne = AccumulatedTicksOne - IntervalOne;
            Velocity = AIUtils.GetRandomVelocity(Speed, Random);
         }
         Position += Velocity;
         base.Update(gameTime);
      }


      public override void Draw()
      {
         GameEngine.Game1.SpriteBatch.Draw(Texture, Position, null, Color, 0f, Vector2.Zero, Vector2.One, SpriteEffects.None, Depth);
         base.Draw();
      }

   }
}